//
//  OperationBillGoodListCell.m
//  LogisticsSupplier
//
//  Created by 吕晶 on 2020/11/10.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "OperationBillGoodListCell.h"

@interface OperationBillGoodListCell ()

@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *lab1;
@property (nonatomic, strong) UILabel *lab2;
@property (nonatomic, strong) UILabel *lab3;
@property (nonatomic, strong) UILabel *lab4;
@property (nonatomic, strong) UILabel *lab5;
@property (nonatomic, strong) UILabel *lab6;
@property (nonatomic, strong) UILabel *lab7;
@property (nonatomic, strong) UILabel *lab8;
@property (nonatomic, strong) UILabel *lab9;
@property (nonatomic, strong) UILabel *lab10;
@property (nonatomic, strong) UILabel *lab11;
@property (nonatomic, strong) UILabel *line;

@end

@implementation OperationBillGoodListCell

+ (instancetype)OperationBillGoodListCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"OperationBillGoodListCell";
    OperationBillGoodListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[OperationBillGoodListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = Color_backgroundColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.bgView = [UIView new];
        self.bgView.backgroundColor = HexColor(0xffffff);
        [self.contentView addSubview:self.bgView];
        
        self.lab1 = [UILabel new];
        self.lab1.textColor = HexColor(0x2B2C44);
        self.lab1.font = [UIFont systemFontOfSize:14];
        self.lab1.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab1];
        
        self.lab2 = [UILabel new];
        self.lab2.textColor = HexColor(0x2B2C44);
        self.lab2.font = [UIFont systemFontOfSize:14];
        self.lab2.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab2];
        
        self.lab3 = [UILabel new];
        self.lab3.textColor = HexColor(0x2B2C44);
        self.lab3.font = [UIFont systemFontOfSize:14];
        self.lab3.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab3];
        
        self.lab4 = [UILabel new];
        self.lab4.textColor = HexColor(0x2B2C44);
        self.lab4.font = [UIFont systemFontOfSize:14];
        self.lab4.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab4];
        
        self.lab5 = [UILabel new];
        self.lab5.textColor = HexColor(0x2B2C44);
        self.lab5.font = [UIFont systemFontOfSize:14];
        self.lab5.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab5];
        
        self.lab6 = [UILabel new];
        self.lab6.textColor = HexColor(0x2B2C44);
        self.lab6.font = [UIFont systemFontOfSize:14];
        self.lab6.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab6];
        
        self.lab7 = [UILabel new];
        self.lab7.textColor = HexColor(0x2B2C44);
        self.lab7.font = [UIFont systemFontOfSize:14];
        self.lab7.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab7];
        
        self.lab8 = [UILabel new];
        self.lab8.textColor = HexColor(0x2B2C44);
        self.lab8.font = [UIFont systemFontOfSize:14];
        self.lab8.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab8];
        
        self.lab9 = [UILabel new];
        self.lab9.textColor = HexColor(0x2B2C44);
        self.lab9.font = [UIFont systemFontOfSize:14];
        self.lab9.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab9];
        
        self.lab10 = [UILabel new];
        self.lab10.textColor = HexColor(0x2B2C44);
        self.lab10.font = [UIFont systemFontOfSize:14];
        self.lab10.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab10];
        
        self.lab11 = [UILabel new];
        self.lab11.textColor = HexColor(0x2B2C44);
        self.lab11.font = [UIFont systemFontOfSize:14];
        self.lab11.textAlignment = NSTextAlignmentCenter;
        [self.bgView addSubview:self.lab11];
        
        self.line = [UILabel new];
        self.line.backgroundColor = Color_backgroundColor;
        [self.bgView addSubview:self.line];
    }
    return self;
}

-(void)setModel:(OperationBillGoodModel *)model {
    _model = model;
    [self configUI];
}

- (void)configUI {
    CGFloat labW = ScreenW * 0.25;
    CGFloat viewW = labW * 11;
    
    self.bgView.frame = CGRectMake(0, 0, viewW, 52);
    
    self.line.frame = CGRectMake(0, 51, viewW, 1);
    
    self.lab1.text = self.model.wa_num;
    [self.lab1 sizeToFit];
    self.lab1.nim_left = 0;
    self.lab1.nim_width = labW;
    self.lab1.nim_centerY = 26;
    
    self.lab2.text = self.model.name;
    [self.lab2 sizeToFit];
    self.lab2.nim_left = self.lab1.nim_right;
    self.lab2.nim_width = labW;
    self.lab2.nim_centerY = 26;
    
    self.lab3.text = self.model.good_type;
    [self.lab3 sizeToFit];
    self.lab3.nim_left = self.lab2.nim_right;
    self.lab3.nim_width = labW;
    self.lab3.nim_centerY = 26;
    
    self.lab4.text = self.model.pk_name;
    [self.lab4 sizeToFit];
    self.lab4.nim_left = self.lab3.nim_right;
    self.lab4.nim_width = labW;
    self.lab4.nim_centerY = 26;
    
    self.lab5.text = self.model.accept_num;
    [self.lab5 sizeToFit];
    self.lab5.nim_left = self.lab4.nim_right;
    self.lab5.nim_width = labW;
    self.lab5.nim_centerY = 26;
    
    self.lab6.text = self.model.weight;
    [self.lab6 sizeToFit];
    self.lab6.nim_left = self.lab5.nim_right;
    self.lab6.nim_width = labW;
    self.lab6.nim_centerY = 26;
    
    self.lab7.text = self.model.volume;
    [self.lab7 sizeToFit];
    self.lab7.nim_left = self.lab6.nim_right;
    self.lab7.nim_width = labW;
    self.lab7.nim_centerY = 26;
    
    self.lab8.text = self.model.jnum;
    [self.lab8 sizeToFit];
    self.lab8.nim_left = self.lab7.nim_right;
    self.lab8.nim_width = labW;
    self.lab8.nim_centerY = 26;
    
    self.lab9.text = self.model.num;
    [self.lab9 sizeToFit];
    self.lab9.nim_left = self.lab8.nim_right;
    self.lab9.nim_width = labW;
    self.lab9.nim_centerY = 26;
    
    self.lab10.text = self.model.goods_describe;
    [self.lab10 sizeToFit];
    self.lab10.nim_left = self.lab9.nim_right;
    self.lab10.nim_width = labW;
    self.lab10.nim_centerY = 26;
    
    self.lab11.text = self.model.batch_num;
    [self.lab11 sizeToFit];
    self.lab11.nim_left = self.lab10.nim_right;
    self.lab11.nim_width = labW;
    self.lab11.nim_centerY = 26;
    
    self.height = self.bgView.nim_bottom;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
